package com.eshipenet.shipnet.equipmentdatahub

import com.esotericsoftware.kryo.io.{Input, Output}
import com.esotericsoftware.kryo.{Kryo, Serializer}
import org.joda.time.DateTime

class DateTimeSerializer extends Serializer[DateTime] {

  override def read(kryo: Kryo, input: Input, `type`: Class[DateTime]): DateTime = {
    val ms = input.readLong()
    new DateTime(ms)
  }

  override def write(kryo: Kryo, output: Output, `object`: DateTime): Unit = {
    output.writeLong(`object`.getMillis)
  }

}
